/**
 * 闪动提示
 * @method  blink
 * @for  jQuery
 * @param {Number} times 闪动次数
 
 */
(function(window, $){
    $.blink = function(el, times, speed){
        var times = times||3;
        var speed = speed||100;
        var count = 0,
            isBlink = false,
            blinkBackground = '#FCC',
            blinkBorder = '#F99',
            timer;

        timer = setInterval(function(){
                if(isBlink){
                    el.css({
                        'background-color': '',
                        'border-color': ''
                    })
                    isBlink = false;
                } else {
                    el.css({
                        'background-color': blinkBackground,
                        'border-color': blinkBorder
                    })
                    isBlink = true;
                }

                count++;

                if (count==times) {
                    clearInterval(timer);
                    return false;
                }

                el.focus();
        }, speed)

        el.change(function() {
            $(this).css({
                'background-color': '',
                'border-color': ''
            })
        })

    }
})(window, jQuery);

$.fn.blink = function(times, speed){
    return this.each(function(){
        $.blink(this, times, speed);
    })
}